﻿using FB.Data.Models;
using FB.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;

namespace FB.Providers.EmployeeInfo
{
    [Table("DepartmentGroups")]
    public class DepartmentGroup
    {
        [Key, StringLength(64)]
        public string DeptGroupID { get; set; }

        [StringLength(256)]
        public string FullName { get; set; }

        [StringLength(256)]
        public string EName { get; set; }
    }

    [Table("emp_Departments")]
    public class Department : FBAuditModel, IOrder, IRecordState, IEmployeeInfoEntity
    {
        [Key, StringLength(8)]
        [Display(ResourceType = typeof(Resources.Models.Department), Name = "DEPTCode")]
        public string DEPTCode { get; set; }

        [Required, StringLength(256)]
        [Display(ResourceType = typeof(Resources.Models.Department), Name = "Name")]
        public string Name { get; set; }

        [Required, StringLength(8)]
        [Display(ResourceType = typeof(Resources.Models.Department), Name = "COMCode")]
        public string COMCode { get; set; }

        [StringLength(8)]
        [Display(ResourceType = typeof(Resources.Models.Department), Name = "ParentDEPTCode")]
        public string ParentDEPTCode { get; set; }


        [EnumDataType(typeof(RecordState))]
        [Display(ResourceType = typeof(Resources.Models.Department), Name = "RecordState")]
        public RecordState RecordState { get; set; }

        [Display(ResourceType = typeof(Resources.Models.Department), Name = "Order")]
        public int? Order { get; set; }


        [ForeignKey("COMCode")]
        public virtual Company Company { get; set; }


        [ForeignKey("ParentDEPTCode")]
        public virtual Department ParentDepartment { get; set; }

        [StringLength(64)]
        public string MasterDeptCode { get; set; }
    }
}
